package 临时工具.csvFile;

import java.io.*;
import java.util.Vector;

public class AnsiToUtf8 {
    public static void main(String[] args) throws UnsupportedEncodingException, IOException {

        ReadFileName tmp=new ReadFileName();
        Vector<String> vec=tmp.FileNameOftype("E:\\WeChat Files\\wxid_nly04s6ax5pq22\\FileStorage\\File\\2025-03\\ifix db\\ifix db", ".csv");

        for (int i=0;i<vec.size(); i++){
            System.out.println(vec.get(i));
            change(vec.get(i));
        }

    }


    public static void change(String filepath) throws UnsupportedEncodingException, IOException{
        BufferedReader buf = null;
        OutputStreamWriter pw=null;
        String str = null;
        String allstr="";

        //用于输入换行符的字节码
        byte[] c=new byte[2];
        c[0]=0x0d;
        c[1]=0x0a;
        String t=new String(c);

        buf=new BufferedReader(new InputStreamReader(new FileInputStream(filepath), "GBK"));
        while((str = buf.readLine()) != null){
            allstr=allstr+str+t;
        }

        buf.close();

        pw =new OutputStreamWriter(new FileOutputStream(filepath),"UTF-8");
        pw.write(allstr);
        pw.close();
    }

}
